package com.geping.etl.utils.common.commonsql;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Map;

/**
 * @Author: wangzd
 * @Date: 2020/7/6
 */
public class CommonFields {

    /**
     * 数据状态
     */
    private String datastatus;

    /**
     * 操作名
     */
    private String operationname;

    /**
     * 操作人
     */
    private String operater;

    /**
     * 操作时间
     */
    private String operationtime;

    /**
     * 审核不通过原因
     */
    private String reason;

    /**
     * 校验状态
     */
    private String checkstatus;

    /**
     * 组织编码
     */
    private String orgid;

    /**
     * 部门编码
     */
    private String deptid;

    public CommonFields() {
    }

    public CommonFields(String datastatus, String operationname, String operater, String reason, String checkstatus, String orgid, String deptid) {
        String format = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        this.datastatus = datastatus;
        this.operationname = operationname;
        this.operater = operater;
        this.operationtime = format;
        this.reason = reason;
        this.checkstatus = checkstatus;
        this.orgid = orgid;
        this.deptid = deptid;
    }

    public static CommonFields initDtj(String operater, String orgid, String deptid){
        return new CommonFields("待提交","",operater,"","未校验",orgid,deptid);
    }

    public Map<String,Object> toMap(Map<String,Object> map){
        map.put("datastatus",this.getDatastatus());
        map.put("operationname",this.getOperationname());
        map.put("operater",this.getOperater());
        map.put("operationtime",this.getOperationtime());
        map.put("reason",this.getReason());
        map.put("checkstatus",this.getCheckstatus());
        map.put("orgid",this.getOrgid());
        map.put("deptid",this.getDeptid());
        return map;
    }

//    public static InterfaceCount addWs(String code,int count,CommonFields fields){
//        return new InterfaceCount("add",code,count,0,0,0,fields.getOrgid(),fields.getDeptid());
//    }

    public String getDatastatus() {
        return datastatus;
    }

    public void setDatastatus(String datastatus) {
        this.datastatus = datastatus;
    }

    public String getOperationname() {
        return operationname;
    }

    public void setOperationname(String operationname) {
        this.operationname = operationname;
    }

    public String getOperater() {
        return operater;
    }

    public void setOperater(String operater) {
        this.operater = operater;
    }

    public String getOperationtime() {
        return operationtime;
    }

    public void setOperationtime(String operationtime) {
        this.operationtime = operationtime;
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    public String getCheckstatus() {
        return checkstatus;
    }

    public void setCheckstatus(String checkstatus) {
        this.checkstatus = checkstatus;
    }

    public String getOrgid() {
        return orgid;
    }

    public void setOrgid(String orgid) {
        this.orgid = orgid;
    }

    public String getDeptid() {
        return deptid;
    }

    public void setDeptid(String deptid) {
        this.deptid = deptid;
    }
}
